<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<link rel="stylesheet"
	href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />

<title>Calculate results</title>
</head>
<body>
	<div class="container">
		<h1>Calculate result</h1>
		<form:form method="POST" commandName="calculate"
			action="${pageContext.request.contextPath}/es/calculate">
			<i>${message }</i>
			<table>
				<tbody>
					<c:forEach var="input" items="${inputs }" varStatus="i">
						<tr>
							<td>Select term for: ${input.name }</td>
							<td><form:select path="inputs[${i.index }].term">
								<form:options items="${terms}" />
							</form:select></td>
							<td><form:errors path="inputs[${i.index }].term" cssStyle="color: red;" /></td>
						</tr>
					</c:forEach>
					<tr>
						<td><input type="submit" value="Calculate" /></td>
						<td></td>
						<td></td>
					</tr>
				</tbody>
			</table>
		</form:form>
		<a href="${pageContext.request.contextPath}/">Home page</a>
	</div>
</body>
</html>